const jwt = require("jsonwebtoken")
const secret = 'ultraman' // 解密密钥

const JWT = {
    generate(value,time){
        return jwt.sign(value,secret,{expiresIn:time})
    },
    verify(token){
        try{
            return jwt.verify(token,secret)
        }catch(e){
            return false
        }
    }
}

module.exports = JWT